 <?php 

$username = $_GET['username'];

$group_id = $_GET['group_id'];

//$username='trang';
$actives = ($_GET['actives']!='false')? "'Active', ": "";
$pendings = ($_GET['pendings']!='false')? "'Pending', ": "";
$solds = ($_GET['solds']!='false')? "'Sold'": "";

$in = $actives.$pendings.$solds;

$in = trim($in);
$in = rtrim($in, ',');
$in = "(".$in.")";
//echo $in;

include("../db/opendb.php");

include("functions.php");

$nquery = "select ID from Users where Username= '".$username."' ";
$nresult = mysql_query($nquery) or die ("SQL Error".mysql_error());
$nrow = mysql_fetch_assoc($nresult);

$user_id = $nrow['ID'];

//$query = "select i.Path as IMAGE, l.OID, l.TITLE, l.LISTSTATUS, l.STREETNUM, l.STREETNAME, l.STREETSUFFIX, l.CITY, l.STATE, l.BEDS, l.BATHSTOTAL, l.SQFTTOTAL, l.PARKINGCOVERED, l.LISTPRICE from PROPERTIES l inner join Prop_Owner_Con p on p.Prop_OID = l.OID inner join Users u on u.ID = p.Owner left join Listing_Images i on (i.Listing_ID = l.OID and i.Main_Photo = 1) where u.Username = '".$username."' and l.LISTSTATUS in ".$in." order by l.LISTSTATUS";

//$queryo = "select First_Name, Last_Name, Email, Phone, IMAGE, CITY, STATE, Website from Users where ID = '".$user_id."' ";
//$resulto = mysql_query($queryo) or die ("SQL Error".mysql_error());
//
//$xml = getXML_start($resulto);


$query = "select First_Name, Last_Name, Email, Phone, IMAGE, CITY, STATE, Website from Users u inner join Network_Groups_Users n on u.ID = n.User_ID where n.Owner = '".$user_id."' and n.Group_ID = '".$group_id."' order by Rand()";

$result = mysql_query($query) or die ("SQL Error".mysql_error());

//$xml = getXML_end($result);

$xml = getXML($result);

echo $xml;

?>
